import numpy as np
import cv2 as cv

# 对 numpy.ndarray 进行处理

def median_blur(img : np.ndarray, *, ksize=3) -> np.ndarray:
    ret = cv.medianBlur(img, ksize)
    if len(ret.shape) == 2:
        ret = np.expand_dims(ret, 2)

    return ret

def bilatera_blur(img : np.ndarray, *, ksize=3) -> np.ndarray:
    ret = cv.bilateralFilter(img, ksize, 75, 75)
    if len(ret.shape) == 2:
        ret = np.expand_dims(ret, 2)

    return ret